/*
 *
 * Copyright (c) 2021
 * User:Dybala
 * File:UserDao.java
 * Date:2021/11/12 20:37:12
 */

package com.dao;

import com.pojo.Comment;
import com.pojo.Notice;
import com.pojo.Report;
import com.pojo.User;
import org.springframework.stereotype.Repository;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

@Mapper
@Repository
public interface UserDao {
    /**
     * 根据用户email和密码找出用户
     * @return 该用户，若查询不到则返回null
     */
    User queryByEmailAndPwd(String email,String pwd);

    /**
     * 根据用户提供的email查找对应的user，这个功能暂时用于注册校验
     * @param email 用户发送的email
     * @return
     */
    User queryByEmail(String email);

    /**
     * 插入一个user
     * @param user 待加入的user
     * @return 修改的行数
     */
    int addUser(User user);

    int updatePwd(String email,String password);

    User queryByUserName(String username);

    int updateUserName(String email,String newName);

    int updatePhone(String phone,String email);
    List<User> queryAll();

    Report getReportTypeTwo(String email);//查看是否已经申诉过了，如果是则不返回0;

    void updateReport(Report report);

    List<Comment>queryComment(String email);

    List<Notice> readNotice();
}
